#pragma  once
#include "NEventPublisher.h"

namespace Engine
{
class NEventQueue
{
private:
	typedef std::list<NEventPublisher *> Queue;

public:
	NEventQueue();

	~NEventQueue();
	
	void Enqueue(NEventPublisher* publisher, float currentWallTime, float delayTime = 0.0);
	
	void Send(const NEventPublisher* publisher, const double& currentWallTime);
	
	void Update(float currentTime);
	
	void Clear(float currentTime, bool deliverExpired = true);
	
	unsigned int Size() const;
	
	static void Initialize();
	
	static void Deinitialize();
	
	static NEventQueue* GetInstance();

private:	
	Queue mQueue;						//!< queue of collected events
	Queue mRemoveQueue;					//!< event to be removed
	static NEventQueue* sInstance;		//!< global queue
};
}